#!/usr/bin/R

#set pond parameters
	area=bottom.elev=initial.elev=array()
	area[1]=1029059; initial.elev[1]=0;  bottom.elev[1]=1.97; #1=pond1
	area[2]=776105;  initial.elev[2]=5;  bottom.elev[2]=1.31; #2=pond2 
	area[3]=161244;  initial.elev[3]=0;  bottom.elev[3]=0.66; #3=pond3
	area[4]=79807; 	 initial.elev[4]=0;  bottom.elev[4]=0; #4=tm1 
	area[5]=80111; 	 initial.elev[5]=0;  bottom.elev[5]=0; #5=tm2  
	area[6]=53560; 	 initial.elev[6]=0;  bottom.elev[6]=0; #6=tm3 
	area[7]=100000;  initial.elev[7]=0;  bottom.elev[7]=0; #7=pilot marsh  
	area[8]=100000;  initial.elev[8]=0;  bottom.elev[8]=1.0; #8=chlorine basin   
	area[9]=471875;  initial.elev[9]=0;  bottom.elev[9]=0; #9=allen  	
	area[10]=322845; initial.elev[10]=0; bottom.elev[10]=-.625; #10=gearheart 
	area[11]=425062; initial.elev[11]=0; bottom.elev[11]=-1.88; #11=hauser
	area[12]=569500; initial.elev[12]=0; bottom.elev[12]=0; #12=brackish
	area[13]=100; 	 initial.elev[13]=0; bottom.elev[13]=0; #13=marsh collection box
	area[14]=100; 	 initial.elev[14]=0; bottom.elev[14]=0; #14=pond collection box
	area[15]=10^10;  initial.elev[15]=0; bottom.elev[15]=0; #15=bay

#set box parameters
	box.elev=array()    #elev of box crest above MSL (m)
	box.width=array()   #weir crest width (m)
	box.links=list()    #water body indices (upstream, downstream)
	roughness=array()   #empirical roughness factor for each box, range[0-1]
	box.type=array()    #1=weir, 2=pump
	box.pump=array()    #pumping rate from upstream to downstream
	box.elev[1]=0;		box.width[1]=100; 	roughness[1]=1; 
	box.type[1]=1;     	box.pump[1]=0; 		box.links[[1]]=c(1,2) #1 = pond1 to pond2
	box.elev[2]=0;  	box.width[2]=100; 	roughness[2]=1; 
	box.type[2]=1;     	box.pump[2]=0; 		box.links[[2]]=c(1,2) #2 = pond1 to pond2
	box.elev[3]=0;     	box.width[3]=10; 	roughness[3]=1; 
	box.type[3]=2;     	box.pump[3]=0; 		box.links[[3]]=c(2,4) #3 = pond2 to tm1...box1
	box.elev[4]=0;     	box.width[4]=100; 	roughness[4]=1; 
	box.type[4]=2;     	box.pump[4]=0; 		box.links[[4]]=c(2,4) #4 = pond2 to tm1...box2
	box.elev[5]=0;     	box.width[5]=100; 	roughness[5]=1; 
	box.type[5]=2;     	box.pump[5]=0; 		box.links[[5]]=c(2,5) #5 = pond2 to tm2...box1
	box.elev[6]=0;     	box.width[6]=100; 	roughness[6]=1; 
	box.type[6]=2;     	box.pump[6]=0; 		box.links[[6]]=c(2,5) #6 = pond2 to tm2...box2
	box.elev[7]=0;     	box.width[7]=100; 	roughness[7]=1; 
	box.type[7]=2;     	box.pump[7]=0; 		box.links[[7]]=c(2,3) #7 = pond2 to pond3...box1
	box.elev[8]=0;     	box.width[8]=100; 	roughness[8]=1; 
	box.type[8]=2;     	box.pump[8]=0; 		box.links[[8]]=c(2,3) #8 = pond2 to pond3...box2
	box.elev[9 ]=0;    	box.width[9]=10; 	roughness[9 ]=1; 
	box.type[9 ]=2;    	box.pump[9 ]=0; 	box.links[[9 ]]=c(4,13) #9 = tm1 to marsh collection box
	box.elev[10]=0; 	box.width[10]=10; 	roughness[10]=1; 
	box.type[10]=2;    	box.pump[10]=0; 	box.links[[10]]=c(5,13) #10 = tm2 to marsh collection box
	box.elev[11]=0; 	box.width[11]=10; 	roughness[11]=1; 
	box.type[11]=2;    	box.pump[11]=0; 	box.links[[11]]=c(5,13) #11 = tm2 to marsh collection box
	box.elev[12]=0;    	box.width[12]=10; 	roughness[12]=1; 
	box.type[12]=2;    	box.pump[12]=0; 	box.links[[12]]=c(5,13) #12 = tm2 to marsh collection box 
	box.elev[13]=0; 	box.width[13]=10; 	roughness[13]=1; 
	box.type[13]=2;    	box.pump[13]=0; 	box.links[[13]]=c(5,13) #13 = tm3 to marsh collection box
	box.elev[14]=0; 	box.width[14]=10; 	roughness[14]=1; 
	box.type[14]=2;    	box.pump[14]=0; 	box.links[[14]]=c(6,13) #14 = tm3 to marsh collection box 
	box.elev[15]=0; 	box.width[15]=10; 	roughness[15]=1; 
	box.type[15]=2;    	box.pump[15]=0; 	box.links[[15]]=c(6,13) #15 = tm3 to marsh collection box
	box.elev[16]=0; 	box.width[16]=10; 	roughness[16]=1; 
	box.type[16]=2;    	box.pump[16]=0; 	box.links[[16]]=c(6,13) #16 = tm3 to marsh collection box
	box.elev[17]=0; 	box.width[17]=10; 	roughness[17]=1; 
	box.type[17]=2;    	box.pump[17]=0; 	box.links[[17]]=c(6,13) #17 = tm3 to marsh collection box
	box.elev[18]=0;    	box.width[18]=100; 	roughness[18]=1; 
	box.type[18]=2;    	box.pump[18]=0; 	box.links[[18]]=c(3,6) #18 = pond3 to tm3
	box.elev[19]=0;    	box.width[19]=100; 	roughness[19]=1; 
	box.type[19]=2;    	box.pump[19]=0; 	box.links[[19]]=c(3,14) #19 = pond3 to pond collection box  
	box.elev[20]=0;    	box.width[20]=100; 	roughness[20]=1; 
	box.type[20]=2;    	box.pump[20]=0; 	box.links[[20]]=c(8,9)  #21 = chlorine to allen 
	box.elev[21]=0;    	box.width[21]=100; 	roughness[21]=1; 
	box.type[21]=2;    	box.pump[21]=0; 	box.links[[21]]=c(8,9)  #22 = chlorine to allen 
	box.elev[22]=0;    	box.width[22]=100; 	roughness[22]=1; 
	box.type[22]=2;    	box.pump[22]=0; 	box.links[[22]]=c(8,9)  #23 = chlorine to allen
	box.elev[23]=0;    	box.width[23]=100; 	roughness[23]=1; 
	box.type[23]=2;    	box.pump[23]=0; 	box.links[[23]]=c(8,9)  #24 = chlorine to allen
	box.elev[24]=1;    	box.width[24]=100; 	roughness[24]=1; 
	box.type[24]=2;    	box.pump[24]=0; 	box.links[[24]]=c(8,9)  #25 = chlorine to allen
	box.elev[25]=1;    	box.width[25]=100; 	roughness[25]=1; 
	box.type[25]=2;    	box.pump[25]=0; 	box.links[[25]]=c(8,9)  #26 = chlorine to allen
	box.elev[26]=1;    	box.width[26]=100; 	roughness[26]=1; 
	box.type[26]=2;    	box.pump[26]=0; 	box.links[[26]]=c(9,10) #27 = allen to gearheart
	box.elev[27]=1;    	box.width[27]=100; 	roughness[27]=1; 
	box.type[27]=2;    	box.pump[27]=0; 	box.links[[27]]=c(9,10) #28 = allen to gearheart
	box.elev[28]=1;    	box.width[28]=100; 	roughness[28]=1; 
	box.type[28]=2;    	box.pump[28]=0; 	box.links[[28]]=c(9,10) #29 = allen to gearheart
	box.elev[29]=1;    	box.width[29]=100; 	roughness[29]=1; 
	box.type[29]=2;    	box.pump[29]=0; 	box.links[[29]]=c(10,11)#30 = gearheart to hauser
	box.elev[30]=1;    	box.width[30]=100; 	roughness[30]=1; 
	box.type[30]=2;    	box.pump[30]=0; 	box.links[[30]]=c(10,11)#31 = gearheart to hauser
	box.elev[31]=1;    	box.width[31]=100; 	roughness[31]=1; 
	box.type[31]=2;    	box.pump[31]=0; 	box.links[[31]]=c(11,12)#32 = hauser to brackish 
	box.elev[32]=1;    	box.width[32]=100; 	roughness[32]=1; 
	box.type[32]=2;    	box.pump[32]=0; 	box.links[[32]]=c(12,15)#33 = brackish to bay    
	box.elev[33]=1;    	box.width[33]=100; 	roughness[33]=1; 
	box.type[33]=2;    	box.pump[33]=0; 	box.links[[33]]=c(4,7)  #34 = tm1 to pilot       
	box.elev[34]=1;    	box.width[34]=100; 	roughness[34]=1; 
	box.type[34]=2;    	box.pump[34]=0; 	box.links[[34]]=c(7,4)  #35 = pilot to tm1       
	box.elev[35]=1;    	box.width[35]=100; 	roughness[35]=1; 
	box.type[35]=2;    	box.pump[35]=0; 	box.links[[35]]=c(3,8)  #36 = pond3 to chlorine  
	box.elev[36]=1;    	box.width[36]=100; 	roughness[36]=1; 
	box.type[36]=2;    	box.pump[36]=0; 	box.links[[36]]=c(3,8)  #37 = pond3 to chlorine (highflow) 
	box.elev[37]=1;    	box.width[37]=100; 	roughness[37]=1; 
	box.type[37]=2;    	box.pump[37]=0; 	box.links[[37]]=c(2,8)  #38 = pond2 to chlorine (highflow) 
	box.elev[38]=1;    	box.width[38]=100; 	roughness[38]=1; 
	box.type[38]=2;    	box.pump[38]=0; 	box.links[[38]]=c(13,8) #39 = marsh collection to chlorine 
	box.elev[39]=1;    	box.width[39]=100; 	roughness[39]=1; 
	box.type[39]=2;    	box.pump[39]=0; 	box.links[[39]]=c(11,8) #40 = hauser to chlorine (highflow)
